package com.wind.beautymaintenanceorders.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wind.common.annotation.Log;
import com.wind.common.core.controller.BaseController;
import com.wind.common.core.domain.AjaxResult;
import com.wind.common.enums.BusinessType;
import com.wind.beautymaintenanceorders.domain.Beautymaintenanceorders;
import com.wind.beautymaintenanceorders.service.IBeautymaintenanceordersService;
import com.wind.common.utils.poi.ExcelUtil;
import com.wind.common.core.page.TableDataInfo;

/**
 * 美容保养订单Controller
 * 
 * @author wind
 * @date 2024-11-13
 */
@RestController
@RequestMapping("/car/beautymaintenanceorders")
public class BeautymaintenanceordersController extends BaseController
{
    @Autowired
    private IBeautymaintenanceordersService beautymaintenanceordersService;

    /**
     * 查询美容保养订单列表
     */
    @PreAuthorize("@ss.hasPermi('car:beautymaintenanceorders:list')")
    @GetMapping("/list")
    public TableDataInfo list(Beautymaintenanceorders beautymaintenanceorders)
    {
        startPage();
        List<Beautymaintenanceorders> list = beautymaintenanceordersService.selectBeautymaintenanceordersList(beautymaintenanceorders);
        return getDataTable(list);
    }

    /**
     * 导出美容保养订单列表
     */
    @PreAuthorize("@ss.hasPermi('car:beautymaintenanceorders:export')")
    @Log(title = "美容保养订单", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Beautymaintenanceorders beautymaintenanceorders)
    {
        List<Beautymaintenanceorders> list = beautymaintenanceordersService.selectBeautymaintenanceordersList(beautymaintenanceorders);
        ExcelUtil<Beautymaintenanceorders> util = new ExcelUtil<Beautymaintenanceorders>(Beautymaintenanceorders.class);
        util.exportExcel(response, list, "美容保养订单数据");
    }

    /**
     * 获取美容保养订单详细信息
     */
    @PreAuthorize("@ss.hasPermi('car:beautymaintenanceorders:query')")
    @GetMapping(value = "/{OrderID}")
    public AjaxResult getInfo(@PathVariable("OrderID") Long OrderID)
    {
        return success(beautymaintenanceordersService.selectBeautymaintenanceordersByOrderID(OrderID));
    }

    /**
     * 新增美容保养订单
     */
    @PreAuthorize("@ss.hasPermi('car:beautymaintenanceorders:add')")
    @Log(title = "美容保养订单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Beautymaintenanceorders beautymaintenanceorders)
    {
        return toAjax(beautymaintenanceordersService.insertBeautymaintenanceorders(beautymaintenanceorders));
    }

    /**
     * 修改美容保养订单
     */
    @PreAuthorize("@ss.hasPermi('car:beautymaintenanceorders:edit')")
    @Log(title = "美容保养订单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Beautymaintenanceorders beautymaintenanceorders)
    {
        return toAjax(beautymaintenanceordersService.updateBeautymaintenanceorders(beautymaintenanceorders));
    }

    /**
     * 删除美容保养订单
     */
    @PreAuthorize("@ss.hasPermi('car:beautymaintenanceorders:remove')")
    @Log(title = "美容保养订单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{OrderIDs}")
    public AjaxResult remove(@PathVariable Long[] OrderIDs)
    {
        return toAjax(beautymaintenanceordersService.deleteBeautymaintenanceordersByOrderIDs(OrderIDs));
    }
}
